////package com.icangya.admin;
////
////import com.alibaba.fastjson.JSONObject;
////import com.icangya.DAO.ICommissionFootDAO;
////import com.icangya.Utils.CountUtils;
////import com.icangya.Utils.FormatUtil;
////import com.icangya.Utils.JSONUtils;
////import com.icangya.Utils.PhoneFormatCheckUtils;
////import com.icangya.Value.FootBall;
////import com.icangya.Value.StaticValue;
////import com.icangya.domain.*;
////import com.icangya.service.*;
////import com.icangya.zhutong.util.HttpRequest;
////import com.icangya.zhutong.util.MD5Gen;
////import com.icangya.zhutong.util.TimeUtil;
////import org.slf4j.Logger;
////import org.slf4j.LoggerFactory;
////import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.web.bind.annotation.*;
////import javax.servlet.http.HttpServletRequest;
////import javax.servlet.http.HttpServletResponse;
////import java.io.IOException;
////import java.io.UnsupportedEncodingException;
////import java.net.URLEncoder;
////import java.sql.Timestamp;
////import java.util.*;
////
////@CrossOrigin
////@RestController
////@RequestMapping(path = "/redwine/game")
////public class RedWineGameController {
////
////    private  Logger logger = LoggerFactory.getLogger(this.getClass());
////    @Autowired
////    private IRedWineGameService iRedWineGameService;
////    @Autowired
////    private IFootUserService iFootUserService;
////    @Autowired
////    private ICommissionFootDAO iCommissionFootDAO;
////    @Autowired
////    private IMoneyService iMoneyService;
////
////
////
////    /**
////     * 获取今日销售额，合伙人分红，我的股权点
////     * @return
////     */
////    @RequestMapping(value = "/getSHS")
////    public JSONObject getSHS(HttpServletRequest request,HttpServletResponse response){
////
////        User  user = getSessionUser(request);
////
////        List<FbPayInfo> list= iRedWineGameService.getFbPayInfoListByDate(new Timestamp(new Date().getTime()));
////
////        JSONObject jsonObject=new JSONObject();
////        double money=0;
////        //销售额
////        if(list !=null) {
////            for (FbPayInfo fbPayInfo : list) {
////                money = money + Double.parseDouble(fbPayInfo.getTotal_fee());
////            }
////        }
////        //合伙人分红
////        RwVariable rwVariable= iRedWineGameService.getRwVariableById(1L);
////        double turnover=0;
////        if(rwVariable!=null){
////            turnover=money*rwVariable.getTurnover();
////        }
////
////        //股权点
////        RwShopShares rwShopShares =iRedWineGameService.getSharesSum(user.getId());
////
////        jsonObject.put("sharesNum",rwShopShares.getSharesNum());//用户股权点
//////        jsonObject.put("turnover",turnover);
////        jsonObject.put("turnover",rwVariable.getAllAmount());//销售额
////        jsonObject.put("money",money);//合伙人分红
////        jsonObject.put("user",user);
////
////        return JSONUtils.getRoot(0,"success",jsonObject);
////
////    }
////    /**
////     * 添加用户申请提现的银行卡信息
////     * @return
////     */
////    @RequestMapping(value = "/addUserBankForPay",method = RequestMethod.POST)
////    public JSONObject addUserBankForPay(double moneys,long bankId,String cardNum, String bankAddr,HttpServletRequest request,HttpServletResponse response){
////
////        User  user = getSessionUser(request);
////
////        if (bankId <= 0){
////            return JSONUtils.getRoot(-3,"银行卡号异常","");
////        }
////        if (cardNum==null||"".equals(cardNum)){
////            return JSONUtils.getRoot(-2,"银行卡号不能为空","");
////        }
////
////        if (bankAddr==null||"".equals(bankAddr)){
////            return JSONUtils.getRoot(-1,"开户行不能为空","");
////        }
////
////        if (moneys < 1 ) {
////            return JSONUtils.getRoot(1,"一元起提","");
////        }
////
////
////
////        synchronized (this) {
////            Commission commission =  iRedWineGameService.getCommissionByUserid(user.getId());
////
////            double myMoney = commission.getMoney();
////
////    //        logger.info("====="+myMoney);
////    //        logger.info("====="+Double.valueOf(String.valueOf(moneys)));
////    //        logger.info("=========================================");
////
////            if (myMoney < moneys){
////                return JSONUtils.getRoot(2,"提现余额不足！","");
////            }
////
////            commission.setMoney(myMoney - moneys);
////
////            RwUserBank rwUserBank = new RwUserBank();
////            rwUserBank.setStatus(0);
////            rwUserBank.setBankAddr(bankAddr);
////            rwUserBank.setCardNum(cardNum);
////            rwUserBank.setCreateTime(new Timestamp(new Date().getTime()));
////            rwUserBank.setPayTime(new Timestamp(new Date().getTime()));
////            rwUserBank.setHeadImg(user.getHeadImgUrl());
////            rwUserBank.setNickName(user.getNickName());
////            rwUserBank.setOpenid(user.getOpenId());
////            rwUserBank.setUserid(user.getId());
////            rwUserBank.setMoneys((int)(moneys * 100));
////            rwUserBank.setBankId(bankId);
////
////            iMoneyService.updateCommission(commission);//更新用户的收益金额
////            iRedWineGameService.saveUserBank(rwUserBank);
////        }
////
////        return JSONUtils.getRoot(0,"success","");
////    }
////
////
////
////      /**
////      * 获取用户de 银行卡信息
////      * @return
////      */
////    @RequestMapping(value = "/getBanksByUserid")
////    public JSONObject getBanksByUserid(HttpServletRequest request,HttpServletResponse response){
////
////        List<RwBank> rwBanks =  iRedWineGameService.getUserbankCardListByuserid(getSessionUser(request).getId());
////
////        return JSONUtils.getRoot(0,"success",rwBanks);
////
////    }
////
////
////
////
////
////    /**
////     * 添加用户de 银行卡信息
////     * @return
////     */
////    @RequestMapping(value = "/getUserBanksByUserid")
////    public JSONObject getUserBanksByUserid(HttpServletRequest request,HttpServletResponse response){
////
////        User  user = getSessionUser(request);
////
////        List<RwUserBank> rwUserBanks = iRedWineGameService.getUserBanksByUserid(user.getId());
////
////        if (rwUserBanks.size()<=0 || rwUserBanks.isEmpty()){
////            return JSONUtils.getRoot(1,"用户未绑定任何银行卡","");
////        }
////        JSONArray jsonArray = new JSONArray();
////        StringBuffer stringBuffer = new StringBuffer("-");
////        for (int i=0;i<rwUserBanks.size();i++){
////            if (rwUserBanks.get(i).getCardNum()!=null||rwUserBanks.get(i).getCardNum().trim().length() > 0){
////                if (!(stringBuffer.indexOf(rwUserBanks.get(i).getCardNum())!=-1)){
////                    stringBuffer.append(rwUserBanks.get(i).getCardNum()).append("-");
////                    JSONObject jsonObject = new JSONObject();
////                    jsonObject.put("cardNum",rwUserBanks.get(i).getCardNum());
////                    jsonObject.put("bankAddr",rwUserBanks.get(i).getBankAddr());
////                    jsonArray.add(jsonObject);
////                }
////            }
////        }
////
////        return JSONUtils.getRoot(0,"success",jsonArray);
////    }
//    /**
//     * 获取轮奸图
//     * @return
//     */
//    @RequestMapping(value = "/getCarouseList")
//    public JSONObject getCarouseList(HttpServletRequest request,HttpServletResponse response) throws IOException {
//
//        List<RwCarousePic> rwCarousePicList = iRedWineGameService.getCarouseList();
//
//        return JSONUtils.getRoot(0,"SUCCESS",rwCarousePicList);
//    }
//    /**
//     * 用户退出
//     * @return
//     */
//    @RequestMapping(value = "/Logout")
//    public JSONObject Logout(HttpServletRequest request,HttpServletResponse response) throws IOException {
//
//        request.getSession().removeAttribute(FootBall.FOOT_USER_SESSION);
//
//        return JSONUtils.getRoot(0,"success","");
////        response.sendRedirect(StaticValue.WX.NO_URL);
//
//    }
//    /**
//     * 用户的团队详情
//     * @return
//     */
//    @RequestMapping(value = "/getTeamInfo")
//    public JSONObject getProxyNum(HttpServletRequest request,HttpServletResponse response){
//
//        User user= getSessionUser(request);
//        JSONObject jsonObject=iFootUserService.getProxyNum(user.getId());
//        return JSONUtils.getRoot(0,"success",jsonObject);
//
//    }
//    /**
//     * 获取用户的金额和订单
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getMoneyAndOrder")
//    public JSONObject getMoneyAndOrder(HttpServletRequest request,HttpServletResponse response){
//
//        try {
//            User user = getSessionUser(request);
//            Commission commission= iCommissionFootDAO.selectUserCommis(user.getOpenId());
//            List<RwGoodOrder> rwGoodOrderList = iRedWineGameService.getRwGoodOrdersByUserId(user.getId());
//
//            int orderNum = 0;
//            if (!rwGoodOrderList.isEmpty()){
//                orderNum = rwGoodOrderList.size();
//            }
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.put("userMoney",commission.getMoney());
//            jsonObject.put("orderNum",orderNum);
//
//            return JSONUtils.getRoot(0,"success",jsonObject);
//        }catch (Exception e){
//            return JSONUtils.getRoot(-1,e.getMessage(),null);
//        }
//    }
//
//    /**
//     * 获取用户信息（熊猫商城只有一条商品）
//     * @return
//     */
//    @RequestMapping(value = "/getUserInfo")
//    public JSONObject getUserInfo(HttpServletRequest request,HttpServletResponse response){
//
//        User user = getSessionUser(request);
//
//        return JSONUtils.getRoot(0,"succsss",user);
//
//    }
//
//    /**
//     * 获取客服图片
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getCustomerPic",method = RequestMethod.GET)
//    public JSONObject getCustomerPic(HttpServletRequest request,HttpServletResponse response) {
//
//        RwVariable rwVariable = iRedWineGameService.getRwVariableById(1l);
//
//        return JSONUtils.getRoot(0,"success",rwVariable);
//    }
//
//    /**
//     * 获取商品信息（熊猫商城只有一条商品）
//     * @return
//     */
//    @RequestMapping(value = "/getShopInfo")
//    public JSONObject getShopInfo(HttpServletRequest request,HttpServletResponse response){
//
//        Rwshop rwshop = iRedWineGameService.getRwshop("1");
//        if (rwshop==null){
//            return JSONUtils.getRoot(-1,"获取已上架商品记录为空，请联系管理员。",rwshop);
//        }
//
//        List<RwshopPic> rwshopPicList = iRedWineGameService.getRwshopPicListByShopId(rwshop.getId());
//
//        JSONObject shopJson = new JSONObject();
//
//        shopJson.put("rwshop",rwshop);
//        shopJson.put("rwshopPicList",rwshopPicList);
//
//        return JSONUtils.getRoot(0,"succsss",shopJson);
//
//    }
//
//    /**
//     * 获取商品主页大图
//     * @return
//     */
//    @RequestMapping(value = "/getMainPic")
//    public JSONObject getMainPic(HttpServletRequest request,HttpServletResponse response){
//
//        Rwshop rwshop = iRedWineGameService.getRwshop("1");
//        if (rwshop==null){
//            return JSONUtils.getRoot(-1,"获取已上架商品记录为空，请联系管理员。",rwshop);
//        }
//
//        List<RwshopPic> rwshopPicList = iRedWineGameService.getRwshopPicListByShopId(rwshop.getId());
//
//        JSONObject shopJson = new JSONObject();
//
//        shopJson.put("picPath",rwshop.getBigPic());
//
//        return JSONUtils.getRoot(0,"succsss",shopJson);
//
//    }
//
//
//    /**
//     * 添加用户地址
//     * @param   status;//状态
//     * @param   sheng;//省
//     * @param   shi;//市
//     * @param   qu;//区
//     * @param   addOther;//自行补充地址
//     * @param   youbian;//邮编
//     * @param   mobilePhone;//用户电话号码；
//     * @param   request
//     * @param   response
//     * @return
//     */
//    @RequestMapping(value = "/insertUserAddress",method = RequestMethod.POST)
//    public JSONObject insertUserAddress(int status,String name,String sheng,String shi,String qu,String addOther,String youbian,String mobilePhone,HttpServletRequest request,HttpServletResponse response){
//
//        if (status > 1 || status  < 0){
//            return JSONUtils.getRoot(-1,"状态只能传 1 或 0 ","");
//        }
//        if("".equals(sheng)||"".equals(shi)||"".equals(qu)||"".equals(youbian)||"".equals(mobilePhone)||"".equals(name)){
//            return JSONUtils.getRoot(-2,"值不能为空","");
//        }
//        if(sheng==null||shi==null||qu==null||youbian==null||mobilePhone==null||name==null){
//            return JSONUtils.getRoot(-3,"值不能为空","");
//        }
//        if (!PhoneFormatCheckUtils.isPhoneLegal(mobilePhone)){
//            return JSONUtils.getRoot(-4,"电话号码格式错误","");
//        }
//
//        if (status==1){
//            //如果status为1，则把当前添加的地址设置为默认地址，其他地址修改为非默认地址，即，修改用户的其他地址状态（status）为0
//            //逻辑待添加
//
//        }
//
//        User user = getSessionUser(request);
//
//        RwUserAddress rwUserAddress =new RwUserAddress();
//        rwUserAddress.setOpenid(user.getOpenId());
//        rwUserAddress.setUserid(user.getId());
//        rwUserAddress.setUserImg("--");
//        rwUserAddress.setUserNickName(name);
//        rwUserAddress.setSheng(sheng);
//        rwUserAddress.setShi(shi);
//        rwUserAddress.setQu(qu);
//        rwUserAddress.setZheng("--");
//        rwUserAddress.setJiedao("--");
//        rwUserAddress.setAddOther(addOther);
//        rwUserAddress.setYoubian(youbian);
//        rwUserAddress.setMobilePhone(mobilePhone);
//        rwUserAddress.setStatus(status);
//        rwUserAddress.setAddress(sheng+shi+qu+addOther);
//        rwUserAddress.setRemark("--");
//
//        long uaid = iRedWineGameService.insertUserAddress(rwUserAddress);
//
//        if (uaid<=0){
//            return JSONUtils.getRoot(-1,"添加失败",uaid);
//        }
//        return JSONUtils.getRoot(0,"success","");
//
//    }
//
//
//    /**
//     * 获取用户的地址列表
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getUserAddressList")
//    public JSONObject getUserAddressList(HttpServletRequest request,HttpServletResponse response){
//
//        User user = getSessionUser(request);
//
//        List<RwUserAddress> rwUserAddresses  = iRedWineGameService.getUserAddressList(user.getId());
//
//        if (rwUserAddresses == null || rwUserAddresses.isEmpty()) {
//
//            JSONUtils.getRoot(1,"用户没有添加地址！",rwUserAddresses);
//        }
//        return JSONUtils.getRoot(0,"success",rwUserAddresses);
//
//    }
//
//
//    /**
//     * 根据地址ID获取用户的地址
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getUserAddressById")
//    public JSONObject getUserAddressById(long addressId,HttpServletRequest request,HttpServletResponse response){
//
////        User user = getSessionUser(request);
//
//        if (addressId <= 0){
//            return JSONUtils.getRoot(-1,"参数错误",null);
//        }
//        RwUserAddress rwUserAddresses  = iRedWineGameService.getUserAddressById(addressId);
//
//        if(rwUserAddresses==null){
//            return JSONUtils.getRoot(1,"查询不到这条地址信息","");
//        }
//
//        return JSONUtils.getRoot(0,"success",rwUserAddresses);
//
//    }
//
//    /**
//     * 根据地址ID删除用户的地址
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/deleteAddressById")
//    public JSONObject deleteAddressById(long addressId,HttpServletRequest request,HttpServletResponse response){
//
//        if (addressId <=0){
//            return JSONUtils.getRoot(-1,"参数错误",null);
//        }
//        try{
//
//            iRedWineGameService.deleteUserAddress(addressId);
//            return JSONUtils.getRoot(0,"success",null);
//
//        }catch (Exception e){
//
//            return JSONUtils.getRoot(-1,e.getMessage(),null);
//
//        }
//
//    }
//
//    /**
//     * 添加一条订单信息
//     * @param numPiece
//     * @param addressId
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/insertOrder",method = RequestMethod.POST)
//    public synchronized JSONObject insertOrder(@RequestParam int numPiece,@RequestParam long addressId, HttpServletRequest request,HttpServletResponse response){
//
//
//        if (numPiece <= 0 || numPiece >= iRedWineGameService.getRwshop("1").getPrice()){
//            return  JSONUtils.getRoot(-1,"订单的商品数量异常，请联系管理员。",null);
//        }
//        if (addressId < 0 || addressId >1000){
//            return JSONUtils.getRoot(-2,"地址ID异常",null);
//        }
//
//        try {
//            //促使订单号能够唯一不重复
//            Thread.sleep(2);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//
//        Rwshop rwShop = iRedWineGameService.getRwshop("1");
//        int sumPrices = rwShop.getPrice() * numPiece;
//        int price = rwShop.getPrice();
//        String intro = rwShop.getIntro();
//        String mainPic = rwShop.getMainPic();
//        RwUserAddress rwUserAddress = iRedWineGameService.getUserAddressById(addressId);
//        User user = getSessionUser(request);
//
//        RwGoodOrder rwGoodOrder = new RwGoodOrder();
//        rwGoodOrder.setCreateTime(new Timestamp(new Date().getTime()));
//        rwGoodOrder.setOpenid(user.getOpenId());
//        rwGoodOrder.setOrderUserImg(user.getHeadImgUrl());
//        rwGoodOrder.setOrderUserNickName(rwUserAddress.getUserNickName());
//        rwGoodOrder.setUserid(user.getId());
//        rwGoodOrder.setMainPic(mainPic);
//        rwGoodOrder.setNumPiece(numPiece);
//        rwGoodOrder.setOrderAddress(rwUserAddress.getAddress());
//        rwGoodOrder.setOrderId("S"+String.valueOf(user.getId())+FormatUtil.getDateTime());
//        rwGoodOrder.setPaystatus(0);
//        rwGoodOrder.setPrice(price);
//        rwGoodOrder.setRemark("order");
//        rwGoodOrder.setSendStatus(0);
//        rwGoodOrder.setSumPices(sumPrices);
//        rwGoodOrder.setAddressId(rwUserAddress.getId());
//        rwGoodOrder.setMobilePhone(rwUserAddress.getMobilePhone());
//        rwGoodOrder.setIntro(intro);
//
//        long oid = iRedWineGameService.saveGoodOrder(rwGoodOrder);
//
//        if (oid > 0){
//
//            return JSONUtils.getRoot(0,"succsss",oid);
//
//        }
//
//        JSONObject errJson = new JSONObject();
//        errJson.put("oid",oid);
//        return JSONUtils.getRoot(-3,"订单添加失败",errJson);
//
//    }
//
//    /**
//     * 获取用户的所有订单信息
//     * @return
//     */
//    @RequestMapping(value = "/getUserOrder")
//    public JSONObject getUserOrder(HttpServletRequest request,HttpServletResponse response){
//
//        List<RwGoodOrder> rwGoodOrders = iRedWineGameService.getRwGoodOrdersByUserId(getSessionUser(request).getId());
//
//        return JSONUtils.getRoot(0,"success",rwGoodOrders);
//
//    }
//
//    /**
//     * 根据id(不是订单号)获取单条订单信息
//     * @param id
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getOrderById",method = RequestMethod.POST)
//    public JSONObject getOrderById(@RequestParam long id, HttpServletRequest request,HttpServletResponse response){
//
//        RwGoodOrder rwGoodOrders = iRedWineGameService.getRwGoodOrderById(id);
//        return JSONUtils.getRoot(0,"success",rwGoodOrders);
//
//    }
//
//    /**
//     * 添加购物车
//     * @param goodNum
//     * @return
//     */
//    @RequestMapping(value = "/saveBuyCar",method = RequestMethod.POST)
//    public JSONObject saveBuyCar(@RequestParam int goodNum, HttpServletRequest request,HttpServletResponse response){
//
//        if (goodNum<=0||goodNum > iRedWineGameService.getRwshop("1").getNumPiece()){
//            return JSONUtils.getRoot(-1,"添加数量错误","");
//        }
//
//        RwBuyCar rwBuyCar = new RwBuyCar();
//        rwBuyCar.setNickName(getSessionUser(request).getNickName());
//        rwBuyCar.setUserid(getSessionUser(request).getId());
//        rwBuyCar.setUserImg(getSessionUser(request).getHeadImgUrl());
//        rwBuyCar.setOpenid(getSessionUser(request).getOpenId());
//        rwBuyCar.setCreateTime(new Timestamp(new Date().getTime()));
//        rwBuyCar.setIntoOrderStatus(0);
//        rwBuyCar.setIntro(iRedWineGameService.getRwshop("1").getIntro());
//        rwBuyCar.setMainPic(iRedWineGameService.getRwshop("1").getMainPic());
//        rwBuyCar.setNumGood(goodNum);
//        rwBuyCar.setRemark("");
//        rwBuyCar.setShopid(iRedWineGameService.getRwshop("1").getId());
//        rwBuyCar.setShopName(iRedWineGameService.getRwshop("1").getShopName());
//
//        long bid =  iRedWineGameService.saveBuyCar(rwBuyCar);
//        if (bid > 0){
//            return JSONUtils.getRoot(0,"success","");
//        }
//
//        JSONObject errJson = new JSONObject();
//        errJson.put("bid",bid);
//        return JSONUtils.getRoot(-2,"添加购物车失败",errJson);
//
//    }
//
//    /**
//     * 获取购物车列表
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getBuyCarEveryGood")
//    public JSONObject getBuyCarEveryGood(HttpServletRequest request,HttpServletResponse response){
//
//        List<RwBuyCar> rwBuyCars = iRedWineGameService.getBuyCarEveryGood(getSessionUser(request).getId());
//
//        return JSONUtils.getRoot(0,"success",rwBuyCars);
//
//    }
//
//    /**
//     * 获取用户推广链接字符串
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/getUserLineStr")
//    public JSONObject getUserLineStr(HttpServletRequest request,HttpServletResponse response){
//
//        User user = getSessionUser(request);
//
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("lineStr",user.getLinestr());
//        jsonObject.put("mobilePhone",FormatUtil.changePhoneShow(user.getMobilePhone()));
//
//        return JSONUtils.getRoot(0,"success",jsonObject);
//
//    }
//
//    /**
//     * 志客的支付回调接口，处理支付成功后的操作
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping(value = "/payNotity")
//    public String payNotity(HttpServletRequest request,HttpServletResponse response){
//
//        try{
//
//            //获取支付回调的参数(根据回调的参数，获取订单信息和用户信息)
//            String orderId = "orderId";
//            //        long userId = 123l;
//            int payMoney = 999;
//
//
//            /**
//             * 更新订单为已支付状态
//             */
//            RwGoodOrder rwGoodOrder = iRedWineGameService.getRwGoodOrderByOrderId(orderId);
//            rwGoodOrder.setPaystatus(1);
//            boolean boo1 = iRedWineGameService.updateGoodOrder(rwGoodOrder);
//
//            //当前充值的用户（购买的用户）
//            User  user = iFootUserService.getUserByUid(rwGoodOrder.getUserid());
//
//
//            /**
//             * 添加支付记录
//             */
//            FbPayInfo fbPayInfo = new FbPayInfo();
//            fbPayInfo.setOpenid(user.getOpenId());
//            fbPayInfo.setMch_trade_id(orderId);
//            fbPayInfo.setTotal_fee(String.valueOf(payMoney));
//            fbPayInfo.setPayDate(new Timestamp(new Date().getTime()));
//            iRedWineGameService.saveFbPayInfo(fbPayInfo);
//
//
//            /**
//             * 返给上级400元
//             */
//            User  fatherUser = iFootUserService.getUserByUid(user.getParentId());
//            CommissionRecord cr1 = new CommissionRecord();
//            Double needRet = 400.00 * ((rwGoodOrder.getSumPices()/100)/999);
//            logger.info("需返佣金额为（400.00 * ((rwGoodOrder.getSumPices()/100)/999)）："+String.valueOf(needRet));
//            cr1.setCommissionMoney(needRet);
//            cr1.setCommissionTime(new Timestamp(new Date().getTime()));
//            cr1.setCommissionType("直推一级商城奖励");
//            cr1.setCommissionTypec(0);
//            cr1.setOpenId(fatherUser.getOpenId());
//            cr1.setUserid(fatherUser.getId());
//            cr1.setRemark("ID为"+user.getId()+"的用户购买了价值"+rwGoodOrder.getSumPices()/100+"元的订单！产生此条返佣记录");
//            iRedWineGameService.saveCommissionRecord(cr1);
//            //累加到用户的佣金总额中
//            Commission commission= iCommissionFootDAO.selectUserCommis(user.getOpenId());
//            commission.setModifiedTime(new Timestamp(new Date().getTime()));
//            commission.setMoney(commission.getMoney()+needRet);
//            boolean result= iCommissionFootDAO.update(commission);
//
//            /**
//             * 返给上级 4 点股份
//             */
//            RwShopSharesRecord rwShopSharesRecord = new RwShopSharesRecord();
//            rwShopSharesRecord.setCreateTime(new Timestamp(new Date().getTime()));
//            rwShopSharesRecord.setOpenid(fatherUser.getOpenId());
//            rwShopSharesRecord.setSharesNum(4);
//            rwShopSharesRecord.setUserid(fatherUser.getId());
//            iRedWineGameService.insertRwShopSharesRecord(rwShopSharesRecord);
//            //累加到用户的股份总数中
//            iRedWineGameService.updateRwShopShares(fatherUser.getId(),4);
//
//
//            /**
//             * 返给上级的上级100元
//             */
//            User  grandfatherUser = iFootUserService.getUserByUid(fatherUser.getParentId());
//            CommissionRecord cr2 = new CommissionRecord();
//            Double needRet2 = 100.00 * ((rwGoodOrder.getSumPices()/100)/999);
//            logger.info("需返佣金额为（400.00 * ((rwGoodOrder.getSumPices()/100)/999)）："+String.valueOf(needRet2));
//            cr2.setCommissionMoney(needRet2);
//            cr2.setCommissionTime(new Timestamp(new Date().getTime()));
//            cr2.setCommissionType("直推二级商城奖励");
//            cr2.setCommissionTypec(0);
//            cr2.setOpenId(grandfatherUser.getOpenId());
//            cr2.setUserid(grandfatherUser.getId());
//            cr2.setRemark("ID为"+user.getId()+"的用户购买了价值"+rwGoodOrder.getSumPices()/100+"元的订单！产生此条返佣记录");
//            iRedWineGameService.saveCommissionRecord(cr2);
//            //累加到用户的佣金总额中
//            Commission commission2= iCommissionFootDAO.selectUserCommis(grandfatherUser.getOpenId());
//            commission2.setModifiedTime(new Timestamp(new Date().getTime()));
//            commission2.setMoney(commission2.getMoney()+needRet2);
//            boolean result2= iCommissionFootDAO.update(commission2);
//
//
//
//            /**
//             * 返给上级的上级 1 点股份
//             */
//            RwShopSharesRecord rwShopSharesRecord2 = new RwShopSharesRecord();
//            rwShopSharesRecord2.setCreateTime(new Timestamp(new Date().getTime()));
//            rwShopSharesRecord2.setOpenid(grandfatherUser.getOpenId());
//            rwShopSharesRecord2.setSharesNum(1);
//            rwShopSharesRecord2.setUserid(grandfatherUser.getId());
//            iRedWineGameService.insertRwShopSharesRecord(rwShopSharesRecord2);
//            //累加到用户的股份总数中
//            iRedWineGameService.updateRwShopShares(grandfatherUser.getId(),1);
//
//            /**
//             * 购买红酒获得vip会员资格
//             */
//            List<RwShopVip> rwShopVipList =  iRedWineGameService.getVipUserByuserid(user.getId());;
//            if (rwShopVipList.isEmpty()){//如果没有vip记录，则用户不是vip，则添加用户vip了
//                RwShopVip rwShopVip = new RwShopVip();
//                rwShopVip.setCreateTime(new Timestamp(new Date().getTime()));
//                rwShopVip.setOrderId(orderId);
//                rwShopVip.setStatus(1);
//                rwShopVip.setNickName(user.getNickName());
//                rwShopVip.setUserid(user.getId());
//                rwShopVip.setUserImg(user.getHeadImgUrl());
//                long sid = iRedWineGameService.saveShopVip(rwShopVip);
//            }else{//如果有vip记录，已经是vip，则无需添加vip了
//
//            }
//
//            //支付订单成功，操作
//            return "success";
//
////            if (sid>0 && boo1){
//                //支付订单成功，操作
////                return "success";
////            }
//        }catch (Exception e){
//            return "faild";
//        }
//    }
//
//
//
//    /**
//     * 获取短信
//     * @param mobilePhone
//     * @throws InterruptedException
//     */
//    @RequestMapping(value = "/getShortLetter")
//    public JSONObject getShortLetter(String mobilePhone,HttpServletRequest request,HttpServletResponse response) throws InterruptedException {
//
//        if (!PhoneFormatCheckUtils.isPhoneLegal(mobilePhone)){
//            return JSONUtils.getRoot(-1,"手机号码格式错误","");
//        }
//
//        int cc = CountUtils.getCountInMinToMax(111111,999999);
//        /**
//         *    账号：sxdh888hy 密码：Ckhj7g
//         *	  账号：sxdh888yx 密码：zKEdCj
//         *    hy是发送验证码和通知信息的账号
//         *	  17093106236
//         */
//        String url="http://www.api.zthysms.com/sendSms.do";
//        String username="sxdh888hy";    //账号
//        String password="Ckhj7g";       // 密码
//        String tkey= TimeUtil.getNowTime("yyyyMMddHHmmss");
//        String mobile=mobilePhone;  //发送的手机号
//        String content= "验证码：" + cc + "【盛世惠农】";   //内容
//
//        JSONObject shortJson = new JSONObject();
//        long curtime = System.currentTimeMillis();
//        shortJson.put("cc",cc);
//        shortJson.put("time",curtime);
//        request.getSession().setAttribute(mobilePhone,shortJson);
//
//        logger.info("当前"+mobilePhone+"的session：" + request.getSession().getAttribute(mobilePhone));
//        //String time="2016-09-06 17:48:22";//定时信息所需参数时间格式为yyyy-MM-dd HH:mm:ss
//        String xh="";
//        try {
//            content= URLEncoder.encode(content, "utf-8");
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        }
//        String param="url="+url+"&username="+username+"&password="+ MD5Gen.getMD5(MD5Gen.getMD5(password)+tkey)+"&tkey="+tkey+"&mobile="+mobile+"&content="+content+"&xh="+xh;
//        //String param="url="+url+"&username="+username+"&password="+MD5Gen.getMD5(MD5Gen.getMD5(password)+tkey)+"&tkey="+tkey+"&time="+time+"&mobile="+mobile+"&content="+content+"&xh="+xh;//定时信息url输出
//        String ret= HttpRequest.sendPost(url,param);//定时信息只可为post方式提交
//        System.out.println("ret:"+ret);
//        System.out.println(param);
//
//        return  JSONUtils.getRoot(0,"发送成功！若未收到短信，请稍后重试！",null);
//
//    }
//
//
//    /**
//     * 获取session中的用户信息
//     * @param request
//     * @return
//     */
//    public User getSessionUser(HttpServletRequest request){
////        User user = new User();
////        user.setOpenId("dfgir4339fm2p30109cm32fn3293");
////        user.setNickName("你大爷");
////        user.setHeadImgUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505803896095&di=778f0d126297b0d0a208acec354503b0&imgtype=0&src=http%3A%2F%2Fimg1.skqkw.cn%3A888%2F2013%2F06%2F17%2F201306171802421285.jpg");
////        user.setId(1L);
////        user.setLinestr("EO4GIW54EYN6LEE");
////        user.setMobilePhone("15815006577");
//        User user = (User) request.getSession().getAttribute(FootBall.FOOT_USER_SESSION);
//        return user;
//    }
//
//
//}
//
//
//
//
//
//
//
//
//
//
//
//
//
